package com.lxj.test_default_websocket.endpoint;

import org.springframework.stereotype.Component;

import javax.websocket.EndpointConfig;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

/**
 * @author Administrator
 */

@ServerEndpoint("/websocket")
@Component
public class MyEndPointController {

    @OnOpen
    public void onOpen(Session session, EndpointConfig config) {
        System.out.println(session);
        System.out.println(config);
        System.out.println("打开了");
    }

    @OnMessage
    public void onMessage(Session session, String message) {
        System.out.println(session);
        System.out.println(message);
        System.out.println("发送消息了");
    }

}
